<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>流程管理</title>
<!-- 引入bootstrap的css文件 -->
<link type="text/css" href="${pageContext.request.contextPath}/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- 自定义样式 -->
<link type="text/css" href="${pageContext.request.contextPath}/css/zc/main.css" rel="stylesheet" />
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/zc/toastr.min.css">
<script type="text/javascript" src="${pageContext.request.contextPath}/bootstrap/js/tests/vendor/jquery.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/bootstrap/dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/zc/toastr.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/toastr/ewinConfirm.js"></script>
</head>
<script type="text/javascript">
	function look(mId){
		window.location.href="${pageContext.request.contextPath}/formManagement/findFormByID.do?mId="+mId;
	}
	function deleteForm(mId){
		Ewin.confirm({ message: "确认要删除选择的表单吗？" }).on(function (e) {
	       if (!e) {
	         return;
	       } 
	       $.ajax({
				type:'get',
				url:'${pageContext.request.contextPath}/flowManagement/deleteForm.do?mId='+mId,
				success:function(isDelete){
					if(isDelete > 0){
						toastr.success("删除表单成功！");
						setTimeout(function(){  //使用  setTimeout（）方法设定定时3000毫秒
							//关闭模态框
							//父页面刷新
							window.location.reload();  
						},2000);
					}else{
						toastr.error("删除表单失败！");
					}
				}
			});
		});
	}
	toastr.options.positionClass = 'toast-top-center'; //提示框的位置设置为中上
</script>
<style>
.choice{
	width: 200px;
	height: 230px;
	margin: auto;
	margin-top: 50px;
}
</style>
<body>
<div class="main">
	<div class="row">
		<c:forEach items="${modelList }" var="m">
		<div class="col-xs-6 col-sm-4 col-md-3">
			<a href="#" class="thumbnail choice">
				<img src="${pageContext.request.contextPath}/image/zc/leave.jpg" >
				<center><p style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">${m.mName}</p></center>
				<button class="btn" onclick="look(${m.mId})">查看表单</button>
				<button class="btn" onclick="deleteForm(${m.mId})">删除表单</button>
			</a>
		</div>
		</c:forEach>
	</div>
</div>
</body>
</html>
